<?php

namespace App\Events;


class CloudEvent extends Event
{
    # types
    const FILE = 1;
    const FOLDER = 2;

    # actions
    const INIT = 0;
    const MAKE = 1;
    const READ = 2;
    const RENAME = 3;
    const REMOVE = 4;


    # 文件ID
    public $id;
    # 所属夫级id
    public $pid;
    # 文件类型，目录／文件
    public $type;
    # 文件名称
    public $name;
    # 文件内容
    public $Filedata;

    # 返回结果
    public $results;


    /**
     * CloudEvent constructor.
     * @param $action
     * @param $type
     * @param $id
     */
    public function __construct($action, $type, $id, $pid=null)
    {
        parent::__construct();
        $this->id = $id;
        $this->pid = $pid;
        $this->type = $type;
        $this->action = $action;
    }

    /**
     * 设置名称
     * @param $name
     */
    public function setName($name)
    {
        $this->name = $name;
    }

    /**
     * 设置文件
     * @param $file
     */
    public function setFile($file)
    {
        $this->Filedata = $file;
    }

    /**
     * 设置返回结果
     * @param $results
     */
    public function setResult($results)
    {
        $this->results = $results;
    }


    /**
     * 获取返回结果
     * @return mixed
     */
    public function getResults()
    {
        return $this->results;
    }
}
